package o;

import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.charset.Charset;
import javax.annotation.Nullable;
import okhttp3.internal.connection.RealConnection;

public final class fxi implements fxg, fxj, Cloneable, ByteChannel {
    private static final byte[] ˊ = new byte[]{(byte) 48, (byte) 49, (byte) 50, (byte) 51, (byte) 52, (byte) 53, (byte) 54, (byte) 55, (byte) 56, (byte) 57, (byte) 97, (byte) 98, (byte) 99, (byte) 100, (byte) 101, (byte) 102};
    long ˎ;
    @Nullable
    fxt ॱ;

    public /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ʾ();
    }

    public /* synthetic */ fxj ʻ(int i) throws IOException {
        return ॱ(i);
    }

    public /* synthetic */ fxj ʼ(int i) throws IOException {
        return ˋ(i);
    }

    public /* synthetic */ fxj ˈ() throws IOException {
        return ˋ();
    }

    public /* synthetic */ fxj ˊ(fxh o_fxh) throws IOException {
        return ˎ(o_fxh);
    }

    public /* synthetic */ fxj ˊ(byte[] bArr) throws IOException {
        return ˎ(bArr);
    }

    public /* synthetic */ fxj ˋ(String str) throws IOException {
        return ˎ(str);
    }

    public /* synthetic */ fxj ˋ(byte[] bArr, int i, int i2) throws IOException {
        return ˊ(bArr, i, i2);
    }

    public /* synthetic */ fxj ˋॱ(long j) throws IOException {
        return ʽ(j);
    }

    public /* synthetic */ fxj ॱˊ(long j) throws IOException {
        return ʻ(j);
    }

    public /* synthetic */ fxj ॱॱ(int i) throws IOException {
        return ˊ(i);
    }

    public final long ॱ() {
        return this.ˎ;
    }

    public fxi ˏ() {
        return this;
    }

    public OutputStream ˎ() {
        return new OutputStream(this) {
            final /* synthetic */ fxi ˊ;

            {
                this.ˊ = r1;
            }

            public void write(int i) {
                this.ˊ.ˊ((byte) i);
            }

            public void write(byte[] bArr, int i, int i2) {
                this.ˊ.ˊ(bArr, i, i2);
            }

            public void flush() {
            }

            public void close() {
            }

            public String toString() {
                return this.ˊ + ".outputStream()";
            }
        };
    }

    public fxi ˋ() {
        return this;
    }

    public fxj ʼ() {
        return this;
    }

    public boolean ᐝ() {
        return this.ˎ == 0;
    }

    public void ˎ(long j) throws EOFException {
        if (this.ˎ < j) {
            throw new EOFException();
        }
    }

    public InputStream ʽ() {
        return new InputStream(this) {
            final /* synthetic */ fxi ˏ;

            {
                this.ˏ = r1;
            }

            public int read() {
                if (this.ˏ.ˎ > 0) {
                    return this.ˏ.ʻ() & 255;
                }
                return -1;
            }

            public int read(byte[] bArr, int i, int i2) {
                return this.ˏ.ˎ(bArr, i, i2);
            }

            public int available() {
                return (int) Math.min(this.ˏ.ˎ, 2147483647L);
            }

            public void close() {
            }

            public String toString() {
                return this.ˏ + ".inputStream()";
            }
        };
    }

    public final fxi ˊ(fxi o_fxi, long j, long j2) {
        if (o_fxi == null) {
            throw new IllegalArgumentException("out == null");
        }
        fxy.ˊ(this.ˎ, j, j2);
        if (j2 != 0) {
            o_fxi.ˎ += j2;
            fxt o_fxt = this.ॱ;
            while (j >= ((long) (o_fxt.ˋ - o_fxt.ˎ))) {
                j -= (long) (o_fxt.ˋ - o_fxt.ˎ);
                o_fxt = o_fxt.ʼ;
            }
            while (j2 > 0) {
                fxt ˏ = o_fxt.ˏ();
                ˏ.ˎ = (int) (((long) ˏ.ˎ) + j);
                ˏ.ˋ = Math.min(ˏ.ˎ + ((int) j2), ˏ.ˋ);
                if (o_fxi.ॱ == null) {
                    ˏ.ॱॱ = ˏ;
                    ˏ.ʼ = ˏ;
                    o_fxi.ॱ = ˏ;
                } else {
                    o_fxi.ॱ.ॱॱ.ˏ(ˏ);
                }
                j2 -= (long) (ˏ.ˋ - ˏ.ˎ);
                o_fxt = o_fxt.ʼ;
                j = 0;
            }
        }
        return this;
    }

    public final long ॱॱ() {
        long j = this.ˎ;
        if (j == 0) {
            return 0;
        }
        fxt o_fxt = this.ॱ.ॱॱ;
        if (o_fxt.ˋ >= 8192 || !o_fxt.ˊ) {
            return j;
        }
        return j - ((long) (o_fxt.ˋ - o_fxt.ˎ));
    }

    public byte ʻ() {
        if (this.ˎ == 0) {
            throw new IllegalStateException("size == 0");
        }
        fxt o_fxt = this.ॱ;
        int i = o_fxt.ˎ;
        int i2 = o_fxt.ˋ;
        int i3 = i + 1;
        byte b = o_fxt.ˏ[i];
        this.ˎ--;
        if (i3 == i2) {
            this.ॱ = o_fxt.ˎ();
            fxs.ˊ(o_fxt);
        } else {
            o_fxt.ˎ = i3;
        }
        return b;
    }

    public final byte ॱ(long j) {
        fxy.ˊ(this.ˎ, j, 1);
        fxt o_fxt;
        if (this.ˎ - j > j) {
            o_fxt = this.ॱ;
            while (true) {
                int i = o_fxt.ˋ - o_fxt.ˎ;
                if (j < ((long) i)) {
                    return o_fxt.ˏ[o_fxt.ˎ + ((int) j)];
                }
                j -= (long) i;
                o_fxt = o_fxt.ʼ;
            }
        } else {
            long j2 = j - this.ˎ;
            o_fxt = this.ॱ.ॱॱ;
            while (true) {
                j2 += (long) (o_fxt.ˋ - o_fxt.ˎ);
                if (j2 >= 0) {
                    return o_fxt.ˏ[o_fxt.ˎ + ((int) j2)];
                }
                o_fxt = o_fxt.ॱॱ;
            }
        }
    }

    public short ॱˊ() {
        if (this.ˎ < 2) {
            throw new IllegalStateException("size < 2: " + this.ˎ);
        }
        fxt o_fxt = this.ॱ;
        int i = o_fxt.ˎ;
        int i2 = o_fxt.ˋ;
        if (i2 - i < 2) {
            return (short) (((ʻ() & 255) << 8) | (ʻ() & 255));
        }
        byte[] bArr = o_fxt.ˏ;
        int i3 = i + 1;
        int i4 = i3 + 1;
        i = ((bArr[i] & 255) << 8) | (bArr[i3] & 255);
        this.ˎ -= 2;
        if (i4 == i2) {
            this.ॱ = o_fxt.ˎ();
            fxs.ˊ(o_fxt);
        } else {
            o_fxt.ˎ = i4;
        }
        return (short) i;
    }

    public int ˋॱ() {
        if (this.ˎ < 4) {
            throw new IllegalStateException("size < 4: " + this.ˎ);
        }
        fxt o_fxt = this.ॱ;
        int i = o_fxt.ˎ;
        int i2 = o_fxt.ˋ;
        if (i2 - i < 4) {
            return ((((ʻ() & 255) << 24) | ((ʻ() & 255) << 16)) | ((ʻ() & 255) << 8)) | (ʻ() & 255);
        }
        byte[] bArr = o_fxt.ˏ;
        int i3 = i + 1;
        int i4 = i3 + 1;
        i = ((bArr[i] & 255) << 24) | ((bArr[i3] & 255) << 16);
        i3 = i4 + 1;
        i |= (bArr[i4] & 255) << 8;
        i4 = i3 + 1;
        i |= bArr[i3] & 255;
        this.ˎ -= 4;
        if (i4 == i2) {
            this.ॱ = o_fxt.ˎ();
            fxs.ˊ(o_fxt);
            return i;
        }
        o_fxt.ˎ = i4;
        return i;
    }

    public short ˊॱ() {
        return fxy.ˏ(ॱˊ());
    }

    public int ˏॱ() {
        return fxy.ˎ(ˋॱ());
    }

    public long ͺ() {
        if (this.ˎ == 0) {
            throw new IllegalStateException("size == 0");
        }
        long j = 0;
        int i = 0;
        Object obj = null;
        Object obj2 = null;
        long j2 = -7;
        do {
            fxt o_fxt = this.ॱ;
            byte[] bArr = o_fxt.ˏ;
            int i2 = o_fxt.ˎ;
            int i3 = o_fxt.ˋ;
            while (i2 < i3) {
                int i4 = bArr[i2];
                if (i4 >= (byte) 48 && i4 <= (byte) 57) {
                    int i5 = 48 - i4;
                    if (j < -922337203685477580L || (j == -922337203685477580L && ((long) i5) < j2)) {
                        fxi ˊ = new fxi().ʽ(j).ˊ(i4);
                        if (obj == null) {
                            ˊ.ʻ();
                        }
                        throw new NumberFormatException("Number too large: " + ˊ.ॱᐝ());
                    }
                    j = (j * 10) + ((long) i5);
                } else if (i4 != 45 || i != 0) {
                    if (i != 0) {
                        obj2 = 1;
                        if (i2 != i3) {
                            this.ॱ = o_fxt.ˎ();
                            fxs.ˊ(o_fxt);
                        } else {
                            o_fxt.ˎ = i2;
                        }
                        if (obj2 == null) {
                            break;
                        }
                    } else {
                        throw new NumberFormatException("Expected leading [0-9] or '-' character but was 0x" + Integer.toHexString(i4));
                    }
                } else {
                    obj = 1;
                    j2--;
                }
                i2++;
                i++;
            }
            if (i2 != i3) {
                o_fxt.ˎ = i2;
            } else {
                this.ॱ = o_fxt.ˎ();
                fxs.ˊ(o_fxt);
            }
            if (obj2 == null) {
                break;
            }
        } while (this.ॱ != null);
        this.ˎ -= (long) i;
        if (obj != null) {
            return j;
        }
        return -j;
    }

    public long ᐝॱ() {
        if (this.ˎ == 0) {
            throw new IllegalStateException("size == 0");
        }
        long j = 0;
        int i = 0;
        Object obj = null;
        do {
            fxt o_fxt = this.ॱ;
            byte[] bArr = o_fxt.ˏ;
            int i2 = o_fxt.ˎ;
            int i3 = o_fxt.ˋ;
            int i4 = i2;
            while (i4 < i3) {
                byte b = bArr[i4];
                if (b >= (byte) 48 && b <= (byte) 57) {
                    i2 = b - 48;
                } else if (b >= (byte) 97 && b <= (byte) 102) {
                    i2 = (b - 97) + 10;
                } else if (b < (byte) 65 || b > (byte) 70) {
                    if (i != 0) {
                        obj = 1;
                        if (i4 != i3) {
                            this.ॱ = o_fxt.ˎ();
                            fxs.ˊ(o_fxt);
                        } else {
                            o_fxt.ˎ = i4;
                        }
                        if (obj == null) {
                            break;
                        }
                    } else {
                        throw new NumberFormatException("Expected leading [0-9a-fA-F] character but was 0x" + Integer.toHexString(b));
                    }
                } else {
                    i2 = (b - 65) + 10;
                }
                if ((-1152921504606846976L & j) != 0) {
                    throw new NumberFormatException("Number too large: " + new fxi().ʻ(j).ˊ((int) b).ॱᐝ());
                }
                i++;
                i4++;
                j = ((long) i2) | (j << 4);
            }
            if (i4 != i3) {
                o_fxt.ˎ = i4;
            } else {
                this.ॱ = o_fxt.ˎ();
                fxs.ˊ(o_fxt);
            }
            if (obj == null) {
                break;
            }
        } while (this.ॱ != null);
        this.ˎ -= (long) i;
        return j;
    }

    public fxh ॱˎ() {
        return new fxh(ʻॱ());
    }

    public fxh ˋ(long j) throws EOFException {
        return new fxh(ॱॱ(j));
    }

    public String ॱᐝ() {
        try {
            return ˊ(this.ˎ, fxy.ˊ);
        } catch (EOFException e) {
            throw new AssertionError(e);
        }
    }

    public String ˏ(long j) throws EOFException {
        return ˊ(j, fxy.ˊ);
    }

    public String ˏ(Charset charset) {
        try {
            return ˊ(this.ˎ, charset);
        } catch (EOFException e) {
            throw new AssertionError(e);
        }
    }

    public String ˊ(long j, Charset charset) throws EOFException {
        fxy.ˊ(this.ˎ, 0, j);
        if (charset == null) {
            throw new IllegalArgumentException("charset == null");
        } else if (j > 2147483647L) {
            throw new IllegalArgumentException("byteCount > Integer.MAX_VALUE: " + j);
        } else if (j == 0) {
            return "";
        } else {
            fxt o_fxt = this.ॱ;
            if (((long) o_fxt.ˎ) + j > ((long) o_fxt.ˋ)) {
                return new String(ॱॱ(j), charset);
            }
            String str = new String(o_fxt.ˏ, o_fxt.ˎ, (int) j, charset);
            o_fxt.ˎ = (int) (((long) o_fxt.ˎ) + j);
            this.ˎ -= j;
            if (o_fxt.ˎ != o_fxt.ˋ) {
                return str;
            }
            this.ॱ = o_fxt.ˎ();
            fxs.ˊ(o_fxt);
            return str;
        }
    }

    public String ॱˋ() throws EOFException {
        return ˊ(Long.MAX_VALUE);
    }

    public String ˊ(long j) throws EOFException {
        long j2 = Long.MAX_VALUE;
        if (j < 0) {
            throw new IllegalArgumentException("limit < 0: " + j);
        }
        if (j != Long.MAX_VALUE) {
            j2 = j + 1;
        }
        long ˋ = ˋ((byte) 10, 0, j2);
        if (ˋ != -1) {
            return ᐝ(ˋ);
        }
        if (j2 < ॱ() && ॱ(j2 - 1) == (byte) 13 && ॱ(j2) == (byte) 10) {
            return ᐝ(j2);
        }
        fxi o_fxi = new fxi();
        ˊ(o_fxi, 0, Math.min(32, ॱ()));
        throw new EOFException("\\n not found: limit=" + Math.min(ॱ(), j) + " content=" + o_fxi.ॱˎ().ᐝ() + '…');
    }

    String ᐝ(long j) throws EOFException {
        if (j <= 0 || ॱ(j - 1) != (byte) 13) {
            String ˏ = ˏ(j);
            ʼ(1);
            return ˏ;
        }
        ˏ = ˏ(j - 1);
        ʼ(2);
        return ˏ;
    }

    public byte[] ʻॱ() {
        try {
            return ॱॱ(this.ˎ);
        } catch (EOFException e) {
            throw new AssertionError(e);
        }
    }

    public byte[] ॱॱ(long j) throws EOFException {
        fxy.ˊ(this.ˎ, 0, j);
        if (j > 2147483647L) {
            throw new IllegalArgumentException("byteCount > Integer.MAX_VALUE: " + j);
        }
        byte[] bArr = new byte[((int) j)];
        ˏ(bArr);
        return bArr;
    }

    public void ˏ(byte[] bArr) throws EOFException {
        int i = 0;
        while (i < bArr.length) {
            int ˎ = ˎ(bArr, i, bArr.length - i);
            if (ˎ == -1) {
                throw new EOFException();
            }
            i += ˎ;
        }
    }

    public int ˎ(byte[] bArr, int i, int i2) {
        fxy.ˊ((long) bArr.length, (long) i, (long) i2);
        fxt o_fxt = this.ॱ;
        if (o_fxt == null) {
            return -1;
        }
        int min = Math.min(i2, o_fxt.ˋ - o_fxt.ˎ);
        System.arraycopy(o_fxt.ˏ, o_fxt.ˎ, bArr, i, min);
        o_fxt.ˎ += min;
        this.ˎ -= (long) min;
        if (o_fxt.ˎ != o_fxt.ˋ) {
            return min;
        }
        this.ॱ = o_fxt.ˎ();
        fxs.ˊ(o_fxt);
        return min;
    }

    public int read(ByteBuffer byteBuffer) throws IOException {
        fxt o_fxt = this.ॱ;
        if (o_fxt == null) {
            return -1;
        }
        int min = Math.min(byteBuffer.remaining(), o_fxt.ˋ - o_fxt.ˎ);
        byteBuffer.put(o_fxt.ˏ, o_fxt.ˎ, min);
        o_fxt.ˎ += min;
        this.ˎ -= (long) min;
        if (o_fxt.ˎ != o_fxt.ˋ) {
            return min;
        }
        this.ॱ = o_fxt.ˎ();
        fxs.ˊ(o_fxt);
        return min;
    }

    public final void ʿ() {
        try {
            ʼ(this.ˎ);
        } catch (EOFException e) {
            throw new AssertionError(e);
        }
    }

    public void ʼ(long j) throws EOFException {
        while (j > 0) {
            if (this.ॱ == null) {
                throw new EOFException();
            }
            int min = (int) Math.min(j, (long) (this.ॱ.ˋ - this.ॱ.ˎ));
            this.ˎ -= (long) min;
            j -= (long) min;
            fxt o_fxt = this.ॱ;
            o_fxt.ˎ = min + o_fxt.ˎ;
            if (this.ॱ.ˎ == this.ॱ.ˋ) {
                fxt o_fxt2 = this.ॱ;
                this.ॱ = o_fxt2.ˎ();
                fxs.ˊ(o_fxt2);
            }
        }
    }

    public fxi ˎ(fxh o_fxh) {
        if (o_fxh == null) {
            throw new IllegalArgumentException("byteString == null");
        }
        o_fxh.ˊ(this);
        return this;
    }

    public fxi ˎ(String str) {
        return ˏ(str, 0, str.length());
    }

    public fxi ˏ(String str, int i, int i2) {
        if (str == null) {
            throw new IllegalArgumentException("string == null");
        } else if (i < 0) {
            throw new IllegalArgumentException("beginIndex < 0: " + i);
        } else if (i2 < i) {
            throw new IllegalArgumentException("endIndex < beginIndex: " + i2 + " < " + i);
        } else if (i2 > str.length()) {
            throw new IllegalArgumentException("endIndex > string.length: " + i2 + " > " + str.length());
        } else {
            while (i < i2) {
                int i3;
                char charAt = str.charAt(i);
                if (charAt < '') {
                    int i4;
                    fxt ˏ = ˏ(1);
                    byte[] bArr = ˏ.ˏ;
                    int i5 = ˏ.ˋ - i;
                    int min = Math.min(i2, 8192 - i5);
                    i3 = i + 1;
                    bArr[i5 + i] = (byte) charAt;
                    while (i3 < min) {
                        char charAt2 = str.charAt(i3);
                        if (charAt2 >= '') {
                            break;
                        }
                        i4 = i3 + 1;
                        bArr[i3 + i5] = (byte) charAt2;
                        i3 = i4;
                    }
                    i4 = (i3 + i5) - ˏ.ˋ;
                    ˏ.ˋ += i4;
                    this.ˎ += (long) i4;
                } else if (charAt < 'ࠀ') {
                    ˊ((charAt >> 6) | 192);
                    ˊ((charAt & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                    i3 = i + 1;
                } else if (charAt < '?' || charAt > '?') {
                    ˊ((charAt >> 12) | 224);
                    ˊ(((charAt >> 6) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                    ˊ((charAt & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                    i3 = i + 1;
                } else {
                    i3 = i + 1 < i2 ? str.charAt(i + 1) : 0;
                    if (charAt > '?' || i3 < 56320 || i3 > 57343) {
                        ˊ(63);
                        i++;
                    } else {
                        i3 = ((i3 & -56321) | ((charAt & -55297) << 10)) + WXMediaMessage.THUMB_LENGTH_LIMIT;
                        ˊ((i3 >> 18) | 240);
                        ˊ(((i3 >> 12) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                        ˊ(((i3 >> 6) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                        ˊ((i3 & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                        i3 = i + 2;
                    }
                }
                i = i3;
            }
            return this;
        }
    }

    public fxi ˎ(int i) {
        if (i < DnsConfig.MAX_CACHE_ENTRIES) {
            ˊ(i);
        } else if (i < 2048) {
            ˊ((i >> 6) | 192);
            ˊ((i & 63) | DnsConfig.MAX_CACHE_ENTRIES);
        } else if (i < WXMediaMessage.THUMB_LENGTH_LIMIT) {
            if (i < 55296 || i > 57343) {
                ˊ((i >> 12) | 224);
                ˊ(((i >> 6) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
                ˊ((i & 63) | DnsConfig.MAX_CACHE_ENTRIES);
            } else {
                ˊ(63);
            }
        } else if (i <= 1114111) {
            ˊ((i >> 18) | 240);
            ˊ(((i >> 12) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
            ˊ(((i >> 6) & 63) | DnsConfig.MAX_CACHE_ENTRIES);
            ˊ((i & 63) | DnsConfig.MAX_CACHE_ENTRIES);
        } else {
            throw new IllegalArgumentException("Unexpected code point: " + Integer.toHexString(i));
        }
        return this;
    }

    public fxi ॱ(String str, Charset charset) {
        return ˊ(str, 0, str.length(), charset);
    }

    public fxi ˊ(String str, int i, int i2, Charset charset) {
        if (str == null) {
            throw new IllegalArgumentException("string == null");
        } else if (i < 0) {
            throw new IllegalAccessError("beginIndex < 0: " + i);
        } else if (i2 < i) {
            throw new IllegalArgumentException("endIndex < beginIndex: " + i2 + " < " + i);
        } else if (i2 > str.length()) {
            throw new IllegalArgumentException("endIndex > string.length: " + i2 + " > " + str.length());
        } else if (charset == null) {
            throw new IllegalArgumentException("charset == null");
        } else if (charset.equals(fxy.ˊ)) {
            return ˏ(str, i, i2);
        } else {
            byte[] bytes = str.substring(i, i2).getBytes(charset);
            return ˊ(bytes, 0, bytes.length);
        }
    }

    public fxi ˎ(byte[] bArr) {
        if (bArr != null) {
            return ˊ(bArr, 0, bArr.length);
        }
        throw new IllegalArgumentException("source == null");
    }

    public fxi ˊ(byte[] bArr, int i, int i2) {
        if (bArr == null) {
            throw new IllegalArgumentException("source == null");
        }
        fxy.ˊ((long) bArr.length, (long) i, (long) i2);
        int i3 = i + i2;
        while (i < i3) {
            fxt ˏ = ˏ(1);
            int min = Math.min(i3 - i, 8192 - ˏ.ˋ);
            System.arraycopy(bArr, i, ˏ.ˏ, ˏ.ˋ, min);
            i += min;
            ˏ.ˋ = min + ˏ.ˋ;
        }
        this.ˎ += (long) i2;
        return this;
    }

    public int write(ByteBuffer byteBuffer) throws IOException {
        if (byteBuffer == null) {
            throw new IllegalArgumentException("source == null");
        }
        int remaining = byteBuffer.remaining();
        int i = remaining;
        while (i > 0) {
            fxt ˏ = ˏ(1);
            int min = Math.min(i, 8192 - ˏ.ˋ);
            byteBuffer.get(ˏ.ˏ, ˏ.ˋ, min);
            i -= min;
            ˏ.ˋ = min + ˏ.ˋ;
        }
        this.ˎ += (long) remaining;
        return remaining;
    }

    public long ˋ(fxw o_fxw) throws IOException {
        if (o_fxw == null) {
            throw new IllegalArgumentException("source == null");
        }
        long j = 0;
        while (true) {
            long ˊ = o_fxw.ˊ(this, 8192);
            if (ˊ == -1) {
                return j;
            }
            j += ˊ;
        }
    }

    public fxi ˊ(int i) {
        fxt ˏ = ˏ(1);
        byte[] bArr = ˏ.ˏ;
        int i2 = ˏ.ˋ;
        ˏ.ˋ = i2 + 1;
        bArr[i2] = (byte) i;
        this.ˎ++;
        return this;
    }

    public fxi ॱ(int i) {
        fxt ˏ = ˏ(2);
        byte[] bArr = ˏ.ˏ;
        int i2 = ˏ.ˋ;
        int i3 = i2 + 1;
        bArr[i2] = (byte) ((i >>> 8) & 255);
        i2 = i3 + 1;
        bArr[i3] = (byte) (i & 255);
        ˏ.ˋ = i2;
        this.ˎ += 2;
        return this;
    }

    public fxi ˋ(int i) {
        fxt ˏ = ˏ(4);
        byte[] bArr = ˏ.ˏ;
        int i2 = ˏ.ˋ;
        int i3 = i2 + 1;
        bArr[i2] = (byte) ((i >>> 24) & 255);
        i2 = i3 + 1;
        bArr[i3] = (byte) ((i >>> 16) & 255);
        i3 = i2 + 1;
        bArr[i2] = (byte) ((i >>> 8) & 255);
        i2 = i3 + 1;
        bArr[i3] = (byte) (i & 255);
        ˏ.ˋ = i2;
        this.ˎ += 4;
        return this;
    }

    public fxi ʽ(long j) {
        if (j == 0) {
            return ˊ(48);
        }
        long j2;
        Object obj;
        if (j < 0) {
            j2 = -j;
            if (j2 < 0) {
                return ˎ("-9223372036854775808");
            }
            obj = 1;
        } else {
            obj = null;
            j2 = j;
        }
        int i = j2 < 100000000 ? j2 < 10000 ? j2 < 100 ? j2 < 10 ? 1 : 2 : j2 < 1000 ? 3 : 4 : j2 < 1000000 ? j2 < 100000 ? 5 : 6 : j2 < 10000000 ? 7 : 8 : j2 < 1000000000000L ? j2 < 10000000000L ? j2 < RealConnection.MAX_RESERVE_DURATION_NS ? 9 : 10 : j2 < 100000000000L ? 11 : 12 : j2 < 1000000000000000L ? j2 < 10000000000000L ? 13 : j2 < 100000000000000L ? 14 : 15 : j2 < 100000000000000000L ? j2 < 10000000000000000L ? 16 : 17 : j2 < 1000000000000000000L ? 18 : 19;
        if (obj != null) {
            i++;
        }
        fxt ˏ = ˏ(i);
        byte[] bArr = ˏ.ˏ;
        int i2 = ˏ.ˋ + i;
        while (j2 != 0) {
            i2--;
            bArr[i2] = ˊ[(int) (j2 % 10)];
            j2 /= 10;
        }
        if (obj != null) {
            bArr[i2 - 1] = (byte) 45;
        }
        ˏ.ˋ += i;
        this.ˎ = ((long) i) + this.ˎ;
        return this;
    }

    public fxi ʻ(long j) {
        if (j == 0) {
            return ˊ(48);
        }
        int numberOfTrailingZeros = (Long.numberOfTrailingZeros(Long.highestOneBit(j)) / 4) + 1;
        fxt ˏ = ˏ(numberOfTrailingZeros);
        byte[] bArr = ˏ.ˏ;
        int i = ˏ.ˋ;
        for (int i2 = (ˏ.ˋ + numberOfTrailingZeros) - 1; i2 >= i; i2--) {
            bArr[i2] = ˊ[(int) (15 & j)];
            j >>>= 4;
        }
        ˏ.ˋ += numberOfTrailingZeros;
        this.ˎ = ((long) numberOfTrailingZeros) + this.ˎ;
        return this;
    }

    fxt ˏ(int i) {
        if (i < 1 || i > 8192) {
            throw new IllegalArgumentException();
        } else if (this.ॱ == null) {
            this.ॱ = fxs.ˋ();
            fxt o_fxt = this.ॱ;
            fxt o_fxt2 = this.ॱ;
            r0 = this.ॱ;
            o_fxt2.ॱॱ = r0;
            o_fxt.ʼ = r0;
            return r0;
        } else {
            r0 = this.ॱ.ॱॱ;
            if (r0.ˋ + i > 8192 || !r0.ˊ) {
                return r0.ˏ(fxs.ˋ());
            }
            return r0;
        }
    }

    public void ˎ(fxi o_fxi, long j) {
        if (o_fxi == null) {
            throw new IllegalArgumentException("source == null");
        } else if (o_fxi == this) {
            throw new IllegalArgumentException("source == this");
        } else {
            fxy.ˊ(o_fxi.ˎ, 0, j);
            while (j > 0) {
                fxt o_fxt;
                if (j < ((long) (o_fxi.ॱ.ˋ - o_fxi.ॱ.ˎ))) {
                    o_fxt = this.ॱ != null ? this.ॱ.ॱॱ : null;
                    if (o_fxt != null && o_fxt.ˊ) {
                        if ((((long) o_fxt.ˋ) + j) - ((long) (o_fxt.ॱ ? 0 : o_fxt.ˎ)) <= 8192) {
                            o_fxi.ॱ.ˏ(o_fxt, (int) j);
                            o_fxi.ˎ -= j;
                            this.ˎ += j;
                            return;
                        }
                    }
                    o_fxi.ॱ = o_fxi.ॱ.ˎ((int) j);
                }
                fxt o_fxt2 = o_fxi.ॱ;
                long j2 = (long) (o_fxt2.ˋ - o_fxt2.ˎ);
                o_fxi.ॱ = o_fxt2.ˎ();
                if (this.ॱ == null) {
                    this.ॱ = o_fxt2;
                    o_fxt2 = this.ॱ;
                    o_fxt = this.ॱ;
                    fxt o_fxt3 = this.ॱ;
                    o_fxt.ॱॱ = o_fxt3;
                    o_fxt2.ʼ = o_fxt3;
                } else {
                    this.ॱ.ॱॱ.ˏ(o_fxt2).ॱ();
                }
                o_fxi.ˎ -= j2;
                this.ˎ += j2;
                j -= j2;
            }
        }
    }

    public long ˊ(fxi o_fxi, long j) {
        if (o_fxi == null) {
            throw new IllegalArgumentException("sink == null");
        } else if (j < 0) {
            throw new IllegalArgumentException("byteCount < 0: " + j);
        } else if (this.ˎ == 0) {
            return -1;
        } else {
            if (j > this.ˎ) {
                j = this.ˎ;
            }
            o_fxi.ˎ(this, j);
            return j;
        }
    }

    public long ॱ(byte b) {
        return ˋ(b, 0, Long.MAX_VALUE);
    }

    public long ˋ(byte b, long j, long j2) {
        if (j < 0 || j2 < j) {
            throw new IllegalArgumentException(String.format("size=%s fromIndex=%s toIndex=%s", new Object[]{Long.valueOf(this.ˎ), Long.valueOf(j), Long.valueOf(j2)}));
        }
        if (j2 > this.ˎ) {
            j2 = this.ˎ;
        }
        if (j == j2) {
            return -1;
        }
        fxt o_fxt = this.ॱ;
        if (o_fxt == null) {
            return -1;
        }
        long j3;
        fxt o_fxt2;
        long j4;
        if (this.ˎ - j >= j) {
            j3 = 0;
            o_fxt2 = o_fxt;
            while (true) {
                j4 = ((long) (o_fxt2.ˋ - o_fxt2.ˎ)) + j3;
                if (j4 >= j) {
                    break;
                }
                o_fxt2 = o_fxt2.ʼ;
                j3 = j4;
            }
        } else {
            j3 = this.ˎ;
            o_fxt2 = o_fxt;
            while (j3 > j) {
                o_fxt2 = o_fxt2.ॱॱ;
                j3 -= (long) (o_fxt2.ˋ - o_fxt2.ˎ);
            }
        }
        j4 = j3;
        while (j4 < j2) {
            byte[] bArr = o_fxt2.ˏ;
            int min = (int) Math.min((long) o_fxt2.ˋ, (((long) o_fxt2.ˎ) + j2) - j4);
            for (int i = (int) ((((long) o_fxt2.ˎ) + j) - j4); i < min; i++) {
                if (bArr[i] == b) {
                    return ((long) (i - o_fxt2.ˎ)) + j4;
                }
            }
            j3 = ((long) (o_fxt2.ˋ - o_fxt2.ˎ)) + j4;
            o_fxt2 = o_fxt2.ʼ;
            j4 = j3;
            j = j3;
        }
        return -1;
    }

    public boolean ˋ(long j, fxh o_fxh) {
        return ˏ(j, o_fxh, 0, o_fxh.ʼ());
    }

    public boolean ˏ(long j, fxh o_fxh, int i, int i2) {
        if (j < 0 || i < 0 || i2 < 0 || this.ˎ - j < ((long) i2) || o_fxh.ʼ() - i < i2) {
            return false;
        }
        for (int i3 = 0; i3 < i2; i3++) {
            if (ॱ(((long) i3) + j) != o_fxh.ˏ(i + i3)) {
                return false;
            }
        }
        return true;
    }

    public void flush() {
    }

    public boolean isOpen() {
        return true;
    }

    public void close() {
    }

    public fxv ˊ() {
        return fxv.ॱ;
    }

    public boolean equals(Object obj) {
        long j = 0;
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof fxi)) {
            return false;
        }
        fxi o_fxi = (fxi) obj;
        if (this.ˎ != o_fxi.ˎ) {
            return false;
        }
        if (this.ˎ == 0) {
            return true;
        }
        fxt o_fxt = this.ॱ;
        fxt o_fxt2 = o_fxi.ॱ;
        int i = o_fxt.ˎ;
        int i2 = o_fxt2.ˎ;
        while (j < this.ˎ) {
            long min = (long) Math.min(o_fxt.ˋ - i, o_fxt2.ˋ - i2);
            int i3 = 0;
            while (((long) i3) < min) {
                int i4 = i + 1;
                byte b = o_fxt.ˏ[i];
                i = i2 + 1;
                if (b != o_fxt2.ˏ[i2]) {
                    return false;
                }
                i3++;
                i2 = i;
                i = i4;
            }
            if (i == o_fxt.ˋ) {
                o_fxt = o_fxt.ʼ;
                i = o_fxt.ˎ;
            }
            if (i2 == o_fxt2.ˋ) {
                o_fxt2 = o_fxt2.ʼ;
                i2 = o_fxt2.ˎ;
            }
            j += min;
        }
        return true;
    }

    public int hashCode() {
        fxt o_fxt = this.ॱ;
        if (o_fxt == null) {
            return 0;
        }
        int i = 1;
        do {
            int i2 = o_fxt.ˎ;
            while (i2 < o_fxt.ˋ) {
                int i3 = o_fxt.ˏ[i2] + (i * 31);
                i2++;
                i = i3;
            }
            o_fxt = o_fxt.ʼ;
        } while (o_fxt != this.ॱ);
        return i;
    }

    public String toString() {
        return ʽॱ().toString();
    }

    public fxi ʾ() {
        fxi o_fxi = new fxi();
        if (this.ˎ == 0) {
            return o_fxi;
        }
        o_fxi.ॱ = this.ॱ.ˏ();
        fxt o_fxt = o_fxi.ॱ;
        fxt o_fxt2 = o_fxi.ॱ;
        fxt o_fxt3 = o_fxi.ॱ;
        o_fxt2.ॱॱ = o_fxt3;
        o_fxt.ʼ = o_fxt3;
        for (o_fxt = this.ॱ.ʼ; o_fxt != this.ॱ; o_fxt = o_fxt.ʼ) {
            o_fxi.ॱ.ॱॱ.ˏ(o_fxt.ˏ());
        }
        o_fxi.ˎ = this.ˎ;
        return o_fxi;
    }

    public final fxh ʽॱ() {
        if (this.ˎ <= 2147483647L) {
            return ʽ((int) this.ˎ);
        }
        throw new IllegalArgumentException("size > Integer.MAX_VALUE: " + this.ˎ);
    }

    public final fxh ʽ(int i) {
        if (i == 0) {
            return fxh.ˏ;
        }
        return new fxu(this, i);
    }
}
